import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {
  AccountListPageDTO,
  SubjectContrastAddDTO,
  SubjectContrastQuery,
  SubjectContrastVO,
  SubjectListTreeVO
} from "@/api/budget/subjectContrast/types";
import { InheritData } from "@/api/budget/contrastDept/types";

/**
 * 查询科目对照列表
 * @param query
 * @returns {*}
 */

export const listSubjectContrast = (query?: SubjectContrastQuery): AxiosPromise<SubjectContrastVO[]> => {
  return request({
    url: "/budget/subject-contrast/list",
    method: "post",
    data: query
  });
};

export const listTree = (query?: SubjectContrastQuery): AxiosPromise<SubjectListTreeVO[]> => {
  return request({
    url: "/budget/subject-contrast/listTree",
    method: "post",
    data: query
  });
};

/**
 * 删除科目对照
 * @param ids
 */
export const delSubjectContrast = (ids: Array<string | number>) => {
  return request({
    url: "/budget/subject-contrast/remove",
    method: "post",
    data: ids
  });
};

/**
 * 继承数据
 * @param data
 */
export const saveInheritData = (data: InheritData) => {
  return request({
    url: "/budget/subject-contrast/inheritData",
    method: "post",
    data: data
  });

};

/**
 * 会计科目列表
 * @param data
 */
export const listAccountSubjectPage = (data: AccountListPageDTO) => {
  return request({
    url: "/budget/subject-contrast/listAccountSubjectPage",
    method: "post",
    data: data
  });

};
/**
 * 对照提交
 * @param data
 */

export const saveSubjectContrast = (data: SubjectContrastAddDTO) => {
  return request({
    url: "/budget/subject-contrast/saveContrast",
    method: "post",
    data: data
  });

};


